#define _CRT_SECURE_NO_WARNINGS 1;
#include <iostream>
#include <list>
#include <vector>
#include <algorithm>

using namespace std;

void list_test1()
{
	list<int> l1;

	list<int> l2(5, 1);

	list<int> l3(l2);

	vector<int> v = { 1,2,3,4 };

	list<int> l4(v.begin(), v.end());

	list<int> l5 = { 1,2,3,4,5 };

	int arr[5] = {1,28,33,42,5};
	list<int> l6(arr, arr + 5);
	
	sort(arr, arr + 5);

	list<int>::iterator it1 = l5.begin();

	while (it1 != l5.end())
	{
		cout << *it1 << " ";
		it1++;
	}
	cout << endl;

	for (auto ch : l5)
	{
		cout << ch << " ";
	}
	cout << endl;
}

void list_test2()
{
	list<int> lt(10,1);
	lt.push_front(10);
	lt.push_back(10);

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;

	lt.insert(lt.begin(), 9);

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;

	lt.erase(lt.begin());

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;

	lt.resize(20);
	
	
	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;


	lt.resize(2);

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;
}


int main()
{
	//list_test1();
	list_test2();

	return 0;
}